<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<link rel="stylesheet" href="${ctx}/resources/js/jquery-treegrid/0.2.0/css/jquery.treegrid.css">
<script type="text/javascript" src="${ctx}/resources/js/jquery-treegrid/0.2.0/js/jquery.treegrid.min.js" />
<script type="text/javascript">
	$(document).ready(function(){
		$(".tree").treegrid({
			treeColumn:0,
			expanderExpandedClass: 'fa fa-minus-square',
			expanderCollapsedClass: 'fa fa-plus-square'
		});
	});
    $(function(){
        $("#column_list tr:gt(0)").click(function(){
        	debugger;
	    	   if($(this).find(":radio").attr("checked")=="checked"){
	    		     $(this).find(":radio").attr("checked",false);
		    	   }else{
		             $(this).find(":radio").attr("checked",true);
		    	   }
             
        });
    });
	function goImage(obj){
		/* var url=document.getElementById("image").src; */
		var url=obj.src;

		console.log("url的值为"+url);

	   window.open(url); 

	}
</script>
<div class="bjui-pageHeader" style="background:#FFF;">
		<form id="pagerForm" data-toggle="ajaxsearch" action="${ctx}/sys/sysColumnAction/toList" method="post">
        	<div style="margin-top: 5px;margin-bottom: 5px;">
		        <!-- 刷新按钮-->
				<button class="btn btn-orange" data-icon="refresh">刷新</button>
				<!-- 添加按钮-->
					<shiro:hasPermission name="columnAdd">
			   	<a id="add_button" href="${ctx}/sys/sysColumnAction/toAdd" class="btn btn-green" data-icon="plus" data-toggle="dialog" data-width="800" data-height="400" data-id="dialog-add" data-mask="true">添加</a>
			 	</shiro:hasPermission>
			   	<!-- 编辑按钮-->
			   	<shiro:hasPermission name="columnEdit">
			   	<a href="${ctx}/sys/sysColumnAction/toEdit?id={#bjui-selected}" class="btn btn-blue" data-icon="edit" data-toggle="dialog" data-width="800" data-height="400" data-id="dialog-edit" data-mask="true">编辑</a>
			   	</shiro:hasPermission>
			    <!-- 删除按钮-->
			   	<shiro:hasPermission name="columnDel">
			    <a href="${ctx}/sys/sysColumnAction/toDel?id={#bjui-selected}" class="btn btn-red" data-toggle="dialog" data-width="600" data-height="300"  data-mask="true" data-id="dialog-del" data-icon="remove">删除</a>
			   	</shiro:hasPermission>
		   	</div>
	   	</form>
	</div>

	<!-- 内容区 -->
	<div class="bjui-pageContent tableContent" id="column_list">
	    <table class="table table-bordered table-hover table-striped table-top tree">
 	     <thead>
	    		<tr style="height:30px;">
	    			<th>状态</th>
		    		<th width="200px">栏目名称</th>
		    		<th>栏目类型</th>
		    		<th>排序编码</th>
		    		<th>栏目关键词</th>
		    		<th>链接地址</th>
		    		<th>栏目图标地址</th>
		    		<th>是否展示</th>
		    		<th>是否在新窗口显示</th>
		    		<th>栏目描述</th>
	    		</tr>
	    	</thead> 
	    	<tbody>
	    	 <c:forEach items="${columnList}" var="p">
	    	 	<tr data-id="${p.id}" class="treegrid-${p.id} treegrid-parent-${p.parentId}">
	    	 		<td><input name="column_radio" type="radio"  /></td>
	    	 		<td>${p.columnName}</td>
	    			<td>${p.columnType}</td>
	    			<td>${p.seqIdx}</td>
	    			<td>${p.keyWords}</td>
	    			<td>${p.linkUrl}</td>
	    		   
	    		    <td><img  width="50px" name="imageUrl" id="imageUrl" onerror="onerror=null;src='${ctx}/resources/lib/andrew/img/noImage.png'" src="${ctx}/${p.imageUrl}"  onclick="goImage(this)"/></td>
	    			<td>${p.display=='0'?'是':'否'}</td>
	    			<td>${p.isNewWindow=='0'?'是':'否'}</td>
	    			<td>${p.description}</td>
	    	 	</tr>
	    	 </c:forEach>
	
	    	</tbody> 
	    </table>
	</div>